//package com.example.springboot.service;
//
//import cn.hutool.core.bean.BeanUtil;
//import cn.hutool.crypto.SecureUtil;
//import com.example.springboot.Exception.ServiceException;
//import cn.hutool.log.Log;
//import com.example.springboot.common.Constants;
//import com.example.springboot.controller.dto.UserDTO;
//import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
//import com.example.springboot.entity.User;
//import com.example.springboot.mapper.Usermapper;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//
//@Service
//public class UserService {
////
////    @Autowired
////    private Usermapper usermapper;
//
////    private static final Log LOG = Log.get();
////
////    public UserDTO login(UserDTO userDTO) {
////        // 用户密码 md5加密
////        userDTO.setPassword(SecureUtil.md5(userDTO.getPassword()));
////        User one = getUserInfo(userDTO);
////        if (one != null) {
////            BeanUtil.copyProperties(one, userDTO, true);
////            return userDTO;
////        } else {
////            throw new ServiceException(Constants.CODE_600, "用户名或密码错误");
////        }
////    }
////
////
////    private User getUserInfo(UserDTO userDTO) {
////        QueryWrapper<User> queryWrapper = new QueryWrapper<>();
////        queryWrapper.eq("username", userDTO.getUsername());
////        queryWrapper.eq("password", userDTO.getPassword());
////        User one;
////        try {
////            //one = getOne(queryWrapper); // 从数据库查询用户信息
////        } catch (Exception e) {
////            LOG.error(e);
////            throw new ServiceException(Constants.CODE_500, "系统错误");
////        }
////        return new User();
////    }
////
////
////
////    public User register(UserDTO userDTO) {
////        // 用户密码 md5加密
////        userDTO.setPassword(SecureUtil.md5(userDTO.getPassword()));
////        User one = getUserInfo(userDTO);
////        if (one == null) {
////            one = new User();
////            BeanUtil.copyProperties(userDTO, one, true);
////            // 默认一个普通用户的角色
////          //  save(one);  // 把 copy完之后的用户对象存储到数据库
////        } else {
////            throw new ServiceException(Constants.CODE_600, "用户已存在");
////        }
////        return one;
////    }
////}
////登录
////public interface IUserService extends <User> {
////
//
////
////}
